﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using TyMES.Model;
using TyMES.Model.BaseInformation;

namespace TyMES.Model.BaseInformation
{
    /// <summary>
    /// 工厂模型
    /// </summary>
	[Table("FactoryInfo")]
    [SoftKey(nameof(Factory.FactoryCode))]
    [Display(Name = "_Model.Factory")]
    public class Factory : BasePoco,IPersistPoco
    {
        [Display(Name = "_Model._Factory._FactoryCode")]
        [Comment("工厂编码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [CanNotEdit]
        public string FactoryCode { get; set; }
        [Display(Name = "_Model._Factory._FactoryName")]
        [Comment("工厂名称")]
        public string FactoryName { get; set; }
        [Display(Name = "_Model._Factory._ManagerID")]
        [Comment("负责人工号")]
        public string ManagerID { get; set; }
        [Display(Name = "_Model._Factory._ManagerName")]
        [Comment("负责人姓名")]
        public string ManagerName { get; set; }
        [Display(Name = "_Model._Workshop._FactoryCode")]
        [InverseProperty("FactoryCode")]
        [NotMapped]
        [SoftFK(nameof(TyMES.Model.BaseInformation.Workshop.FactoryCodeId))]
        public List<Workshop> Workshop_FactoryCode { get; set; }
        [Display(Name = "_Model._Factory._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;

	}

}
